const http = require('../../utils/http.js');   //相对路径
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },
  attached: function () {
    http.postRequest('/mini/v1/home/service', {}, res=>{
        this.setData({
          waitExecute: res.data.wait_execute,//待施工数量 <number>
          waitFinish: res.data.wait_finish,//待完工数量 <number>
          waitClearing: res.data.wait_clearing,
          noticeData:res.data.notice_data
        })
        wx.setNavigationBarTitle({
          title:res.data.shop_name    // 其他页面传过来的标题名
        })
    }) 
  },
  /**
   * 组件的初始数据
   */
  data: {
    current: 0,
    waitExecute: '',//待施工数量 <number>
    waitFinish: '',//待完工数量 <number>
    waitClearing: '',//待结算数量 <number>
    noticeData:[]
  },
  /**
   * 组件的方法列表
   */
  methods: {
    gopage(){
        wx.navigateTo({
          url: '/pages/index/child/message?noticeData='+this.data.noticeData,
        })
    },
    statepage(e){
      let name=e.currentTarget.dataset.name
      if(name == 'await'){
        wx.navigateTo({
          url: '/pages/openOrder/repair/repair',
        })
      }else if(name == 'asbuilt'){//客户查询
        wx.navigateTo({
          url: '/pages/classify/kehu',
        })
      }else if(name == 'close'){//服务查询
        wx.navigateTo({
          url: '/pages/classify/fuwu',
        })
      }
    },
    gopagegondanguanli(e) {
      let name=e.currentTarget.dataset.name
        wx.navigateTo({
          url: '/pages/index/work/work?name=' + name
        })
    },
    jump(e){
      let name=e.currentTarget.dataset.name
      if(name == 'yujian'){
        wx.navigateTo({
          url: '/pages/openOrder/preview/preview',
        })
      }else if(name == 'wash'){
        wx.navigateTo({
          url: '/pages/openOrder/wash/wash',
        })
      }else if(name == 'repair'){
        wx.navigateTo({
          url: '/pages/openOrder/repair/repair',
        })
      }else if(name == 'sell'){
        wx.navigateTo({
          url: '/pages/openOrder/sell/sell',
        })
      }
    },
    card(e){
      let name=e.currentTarget.dataset.name
      if(name == 'select'){
        wx.navigateTo({
          url: '/pages/classify/kehu',
        })
      }else if(name == 'openCard'){
        wx.navigateTo({
          url: '/pages/openCard/openCard/openCard',
        })
      }else if(name == 'cardList'){
        wx.navigateTo({
          url: '/pages/openCard/bySingle/bySingle',
        })
      }else if(name == 'cardManage'){
        wx.navigateTo({
          url: '/pages/openCard/cardManage/cardManage',
        })
      }
    }
  }
})